package common.view;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JList;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class LivePurchaseOrderView extends JPanel{
	private JTable table;
	private JList list;
	private JButton btnSave;
	public LivePurchaseOrderView() {
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblOpenPurchaseOrders = new JLabel("Open Purchase Orders:");
		springLayout.putConstraint(SpringLayout.NORTH, lblOpenPurchaseOrders, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblOpenPurchaseOrders, 10, SpringLayout.WEST, this);
		add(lblOpenPurchaseOrders);
		
		btnSave = new JButton("SAVE");
		springLayout.putConstraint(SpringLayout.WEST, btnSave, 131, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, btnSave, -41, SpringLayout.SOUTH, this);
		add(btnSave);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 6, SpringLayout.SOUTH, lblOpenPurchaseOrders);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, -10, SpringLayout.NORTH, btnSave);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, 164, SpringLayout.WEST, this);
		add(scrollPane);
		
		list = new JList();
		scrollPane.setViewportView(list);
		
		JScrollPane scrollPane_1 = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane_1, 28, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane_1, 10, SpringLayout.EAST, scrollPane);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane_1, -10, SpringLayout.NORTH, btnSave);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane_1, -10, SpringLayout.EAST, this);
		add(scrollPane_1);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"Sr No.", "Item", "Specifications", "Unit", "Rate", "Discount", "Amount"
			}
		));
		scrollPane_1.setViewportView(table);
	}
	public JTable getTable() {
		return table;
	}
	public void setTable(JTable table) {
		this.table = table;
	}
	public JList getList() {
		return list;
	}
	public void setList(JList list) {
		this.list = list;
	}
	public JButton getBtnSave() {
		return btnSave;
	}
	public void setBtnSave(JButton btnSave) {
		this.btnSave = btnSave;
	}
	
}
